package com.woniuxy.dao.impl;

import com.woniuxy.dao.UserDao;
import com.woniuxy.entity.User;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class UserDaoImpl implements UserDao {
    private SqlSession sqlSession;

    public void setSqlSession(SqlSession sqlSession) {
        this.sqlSession = sqlSession;
    }

    @Override
    public User findOne(int id) {
        UserDao userDao = sqlSession.getMapper(UserDao.class);
        return userDao.findOne(id);
    }

    @Override
    public List<User> findAll() {
        UserDao userDao = sqlSession.getMapper(UserDao.class);
        return userDao.findAll();
    }

    @Override
    public int addOne(User user) {
        UserDao userDao = sqlSession.getMapper(UserDao.class);
        return userDao.addOne(user);
    }

    @Override
    public int updateOne(User user) {
        return 0;
    }

    @Override
    public int deleteOne(int id) {
        return 0;
    }

    @Override
    public List<User> findOneByLikeName(String name) {
        return null;
    }
}
